<section class="objects panel rounded">
	<h1>Objects</h1>
	
	<div class="table">
		<div class="thead">
			<div class="th name"><?php echo lang('heading_name'); ?></div>
			<div class="th actions"><?php echo lang('heading_actions'); ?></div>
			<div class="clear"></div>
		</div>
		<div class="tbody">
			<?php foreach ($objects as $object) { ?>
			<form id="row<?php echo $object->id; ?>" action="api/object/update/<?php echo $object->id; ?>" method="post" class="row">
					<div class="td name"><input name="name" type="text" value="<?php echo $object->table; ?>" /></div>
					<div class="td actions">
						<?php if ($this->user->is_admin()) { ?>
						<a href="api/object/delete/<?php echo $object->id; ?>"><?php echo lang('action_delete'); ?></a>
						<a href="javascript:void(0);" onClick="$('#row<?php echo $object->id; ?>').submit();"><?php echo lang('action_update'); ?></a>
						<a href="objects/<?php echo $object->id; ?>"><?php echo lang('action_edit_structure'); ?></a>
						<?php } ?>
						<a href="objects/<?php echo $object->id; ?>/entries"><?php echo lang('action_entries'); ?></a>
					</div>
					<div class="clear"></div>
			</form>
			<?php }
			
			if ($this->user->is_admin()) { ?>
			<form class="new" action="api/object/insert/" method="post">
					<div class="td name">
						<input name="name" type="text"/>
					</div>
					<div class="td actions">
						<a href="javascript:void(0);" onClick="$('form.new').submit();"><?php echo lang('action_insert'); ?></a>
					</div>
					<div class="clear"></div>
			</form>
			<?php } ?>
		</div>
	
	</div>
</section>
<?php if (!$this->user->is_admin()) { ?>
<script>
	$('input').attr('readonly','readonly');
</script>
<?php } ?>
